export function toBigint(text: string, errorSupplier: () => any): bigint {
  try {
    return BigInt(text);
  } catch (err) {
    throw errorSupplier();
  }
}

export function toBigint2(text: string): { ok: true; value: bigint } | { ok: false; value: undefined } {
  try {
    return { ok: true, value: BigInt(text) };
  } catch (err) {
    return { ok: false, value: undefined };
  }
}
